-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Implementation of the Odoo Estate module as outlined in the official tutorial #847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Conversation
bc7078f
to
9aa35ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the review.
Many commits includes changes that are not related to that specific commit, i.e, you change code that should instead be amended in the original commit itself, can you fix such issues.
I would suggest you to check the review commit by commit.
estate/__init__.py
Outdated
@@ -0,0 +1,2 @@ | |||
|
|||
from . import models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to always add a EOL in each file so that when someone adds lines in the future, the last line of the previous devs is not in the diff. Also github shows a red marker for it.
estate/__manifest__.py
Outdated
'category': 'Tutorials/RealEstate', | ||
'application': True, | ||
'installable': True | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary empty line.
estate/models/estate_property.py
Outdated
name = fields.Char() | ||
description= fields.Text() | ||
postcode = fields.Text() | ||
date_availability = fields.Date() | ||
expected_price = fields.Float() | ||
selling_price = fields.Integer() | ||
bedrooms = fields.Integer() | ||
living_area = fields.Integer() | ||
facades = fields.Integer() | ||
garage = fields.Boolean() | ||
garden = fields.Boolean() | ||
garden_area = fields.Integer() | ||
garden_orientation = fields.Selection( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing the string property.
estate/models/estate_property.py
Outdated
garden_area = fields.Integer() | ||
garden_orientation = fields.Selection( | ||
string='Type', | ||
selection=[('north', 'North' 'East' 'West'), ('south', 'South'),('east', 'East'),('west', 'West')], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
('north', 'North' 'East' 'West')?
I see you fix it in next commit better to fix it in the original commit itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, Got it
estate/models/estate_property.py
Outdated
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary empty lines.
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
estate/models/estate_property.py
Outdated
@api.ondelete(at_uninstall=False) | ||
def _unlink_if_state_new_or_cancelled(self): | ||
for data in self: | ||
if not bool(self.state == 'new' or self.state == 'cancelled') : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once again incorrect use of self.
It should be data.state not in ('new', 'cancelled')
estate_account/__manifest__.py
Outdated
'data': [ | ||
|
||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty?
@@ -168,7 +167,7 @@ def _check_selling_price(self): | |||
@api.ondelete(at_uninstall=False) | |||
def _unlink_if_state_new_or_cancelled(self): | |||
for data in self: | |||
if not bool(self.state == "new" or self.state == "cancelled"): | |||
if not bool(data.state == "new" or data.state == "cancelled"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and you changed it in the last commit better to do it in the original commit.
from odoo.tools.float_utils import float_compare | ||
|
||
|
||
class EstatePropertyOffer(models.Model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind that the convention for model ordering is:
- Private attributes (_name, _description, _inherit, _sql_constraints, …)
- Default method and default_get
- Field declarations
- Compute, inverse and search methods in the same order as field declaration
- Selection method (methods used to return computed values for selection fields)
- Constrains methods (@api.constrains) and onchange methods (@api.onchange)
- CRUD methods (ORM overrides)
- Action methods
- And finally, other business methods.
Same for all the models you have created.
PR title should also follow the same convention as commit msg title. |
Created new 'estate' module. Added base model 'estate.property' with fields mentioned in exercise. Set up module structure. Set 'name' and 'expected_price' as required fields.
9aa35ca
to
db44e2c
Compare
This commit introduces the initial version of the estate module as part of the Odoo 18 developer tutorial. The module includes basic models, access rights, security rules, and simple form and tree views for managing real estate properties. The purpose of this change is to set up a foundational structure for the module. It follows the official tutorial steps to demonstrate Odoo’s ORM, security mechanisms, and view definitions. Adding proper access control ensures that only authorized users can interact with the module. The initial UI provides the groundwork for extending functionality later. This is part of a learning exercise to understand Odoo’s server framework and how to implement a feature-rich module following best practices.
-Created new models for property offers,tags and types. -Defined relation between these data models for accessing data across the model. -Created new views for property types,property tags. -Defined action on button click , created computed fields .
Added SQL constraints to ensure: Property expected price is strictly positive, Property selling price is positive, Offer price is strictly positive, Property tag name and property type name are unique, , Added Python constraint to prevent selling price from being set below 90% of expected price, Changes in UI: Added inline list view for properties on property type form, Used statusbar widget for property state display, Defined default ordering for models and enabled manual ordering for property types via sequence field, Applied widget options to restrict creation/editing of property types from property form
Added model and view inheritance for extending existing functionality., Implemented interaction with external modules using dependencies., Updated estate module to demonstrate cross-module field access and method calls.
- Cleaned up code to meet linting and CI style standards.
db44e2c
to
20968e6
Compare
Implemented cross-module field access and method calls to demonstrate interaction with other modules., Cleaned codebase to fix linter errors and improve readability.
20968e6
to
4cd0123
Compare
Added demo data and security data to the estate module., Implemented record rules and access rights to restrict data access based on user groups., Updated manifest.py to load new data files.
93ef095
to
532c013
Compare
-Created a PDF report for estate properties listing all property offers using QWeb templates and report actions. -Extended the report in estate_account to include invoice details for sold properties. -Organized templates and report actions within their respective modules. -Updated manifest files to register new reports. -Enhances reporting by allowing users to generate comprehensive property and financial documents from the UI.
9402844
to
db8e46e
Compare
Introduced new unit tests in the estate module covering key business processes: Prevent offer creation on sold properties., Disallow marking properties as sold without an accepted offer., Ensure garden area and orientation fields reset appropriately when garden is unchecked. These tests improve the reliability and maintainability of the estate workflow.
9cfc791
to
fcaef25
Compare
This PR adds demo data to the estate module as per the Odoo Estate tutorial.
Features:
-Estate module initialization and configuration
-Property model definition with key fields
-Basic list and form views
-Menu and action setup for navigation
-Implemented Inheritance